/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.neaghfoz.code;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import java.sql.Connection;

import com.myapp.share.*;

import java.util.*;
import java.sql.*;
import java.util.Iterator;
import javax.sql.DataSource;
import javax.naming.*;

/**
 *
 * @author NeaghFoz
 */
public class test {

    public static void main(String[] args) {
        String password = "";
        try {
            InitialContext initCtx = new InitialContext();
            DataSource ds = (DataSource) initCtx.lookup("java:/comp/env/jdbc/connectionPool");
            Connection conn = ds.getConnection();
            Statement stmt = conn.createStatement();
            String sql = "select UserPassword from userinfo where UserName='tregeide'";
            ResultSet rs = stmt.executeQuery(sql);
            while (rs.next()) {
            password = rs.getString("UserPassword");
            }
            rs.close();
            stmt.close();
            conn.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
